﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _05_委托练习
{
    public delegate void ChangeLabel(string dateTime);

    public partial class Form1 : Form
    {
        ChangeLabel changeLabel;

        public Form1()
        {
            InitializeComponent();
        }
        private void button2_Click(object sender, EventArgs e)
        {
    
            Form2 fr2 = new Form2();
            changeLabel +=  dateTime=> fr2.label1.Text = dateTime;
            fr2.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            changeLabel.Invoke(DateTime.Now.ToString());
        }




    }
}
